let db = require('./index.js');

function query(params) {
  return new Promise((resolve, reject) => {

    let sql = params ? `select * from inter where type="${params}"` : `select * from inter`;
    db.query(sql, (err, result) => {
      if (err) {
        console.log(err);
        reject(err);
      } else {
        resolve(result);
      }
    })
  })
}

module.exports = {
  query
};
